// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router/pages'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from '@/api/axios'
// import iconPicker from 'vue-fontawesome-elementui-icon-picker';
import iconPicker from 'e-icon-picker';
import 'e-icon-picker/lib/index.css';//基础样式
import 'font-awesome/css/font-awesome.min.css'; //fontAwesome 图标库样式
import myapi from '@/api/apiList'
import myDivider from '@/components/myDivider.vue'
import myupload from '@/components/myupload.vue'
import myPagination from '@/components/myPagination'
import Vue2OrgTree from 'vue2-org-tree'



let eventBus = new Vue()
Vue.prototype.$eventBus = eventBus
Vue.use(Vue2OrgTree)
Vue.component('myPagination', myPagination)
Vue.component('myDivider', myDivider)
Vue.component('myupload', myupload)
Vue.config.productionTip = false
Vue.prototype.$http = axios
Vue.prototype.$api = myapi
Vue.use(ElementUI);
Vue.use(iconPicker, {
  FontAwesome: true,
  ElementUI: false,
  eIcon: true,//自带的图标，来自阿里妈妈
  eIconSymbol: true,//是否开启彩色图标
  addIconList: [],
  removeIconList: [],
  zIndex: 3100//选择器弹层的最低层,全局配置
});


Vue.prototype.$http = axios



//  按钮权限控制指令
Vue.directive('permission', {
  inserted: (el, binding) => {
    const { value } = binding;
    // 判断当前用户是否拥有该按钮权限
    if (!checkPermission(value)) {
      el.parentNode.removeChild(el);
    }
  }
});
// 判断权限的函数
function checkPermission(permission) {
  var permissions = JSON.parse(sessionStorage.getItem('limits'))
  return permissions[permission];
}




/* eslint-disable no-new */
export default new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
  axios

})
